package internal

import (
	"fmt"
	"mall/common/config"
	"mall/common/utils"
)

func ConsumeMsgFromOrderQueue() error {
	channel, err := utils.GetRabbitMQChannel()
	if err != nil {
		return err
	}
	msgS, err := channel.Consume(config.SeckillOrderQueueName, "", false, false, false, false, nil)
	if err != nil {
		return err
	}
	for msg := range msgS {
		fmt.Println(msg.Body)
		msg.Ack(false)
	}
	return nil
}
